import './shims/core-js.js'

import { createApp } from 'vue'
import App from './App.vue'
import router from './router' // api: https://github.com/vuejs/vue-router
import store from './store' // 导入Vuex store
// import VueCookie from 'vue-cookie'            // api: https://github.com/alfhen/vue-cookie
import '@/element-ui' // api: https://github.com/ElemeFE/element
import '@/icons' // api: http://www.iconfont.cn/
import '@/element-ui-theme/index.js'
import '@/assets/scss/index.scss'
import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
import { isAuth } from '@/utils'
import cloneDeep from 'lodash/cloneDeep'
import ElementUI from './element-ui' // 导入兼容层
// import './element-ui-theme/index.js'  // 旧路径
import 'element-plus/dist/index.css' // 确保正确引入
import ElementPlus from 'element-plus'
import IconSvg from '@/components/icon-svg/index.vue' // 导入 IconSvg 组件

// Vue.use(VueCookie)

// 非生产环境, 适配mockjs模拟数据                 // api: https://github.com/nuysoft/Mock
// if (process.env.NODE_ENV !== 'production') {
//   require('@/mock')
// }

// 挂载全局
// Vue.prototype.$http = httpRequest // ajax请求方法
// Vue.prototype.isAuth = isAuth // 权限方法

// 保存整站vuex本地储存初始状态
// window.SITE_CONFIG['storeState'] = cloneDeep(store.state)

// Vue 3的应用创建方式
const app = createApp(App)

app.config.globalProperties.$http = httpRequest;
app.config.globalProperties.$isAuth = isAuth;

// 配置全局属性
app.config.productionTip = false

// 注册全局组件
app.component('IconSvg', IconSvg)

// 使用插件
app.use(router)
app.use(store) // 使用Vuex

app.use(ElementPlus)
// app.use(ElementUI, {
//   size: 'small',
//   zIndex: 3000
// })

// 挂载应用
app.mount('#app')
